library(data.table)
library(tidyverse)
library(latex2exp)


dir.project <- './'
dir.generated <- './data/generated/matlab/'


## Load data
robustness_data_incr <- read.csv(paste0(dir.generated, 'OptimTax/gpops/sensitivity_vars_kappa_R_incr.csv'))
robustness_data_decr <- read.csv(paste0(dir.generated, 'OptimTax/gpops/sensitivity_vars_kappa_R_decr.csv'))
robustness_data_combined <- rbind(robustness_data_incr, robustness_data_decr)


## Contour plot
ggplot(robustness_data_combined, aes(x=prod_fun_kappa_R, y=1-prod_fun_eta_R, z=tau_B*100)) +
  geom_contour_filled() +
  xlab(TeX('$\\kappa_{R}$')) +
    ylab(TeX('$\\gamma_{B,R}$'))

## figures directory for output
dir.fig <- paste0(dir.project, 'doc/paper/figures/sensitivity/')

ggsave(
  paste0(dir.fig, "robustness_kappa_gamma.pdf"),
  width = 12,
  height = 8,
  units = "cm"
)
